// ignore_for_file: depend_on_referenced_packages

import 'dart:io';

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:retrofit/http.dart';
import 'package:dio/dio.dart';
import 'package:retrofit/dio.dart';

import 'Initial.dart';

part 'AuthrizationApi.g.dart';
part 'AuthrizationApi.freezed.dart';

@RestApi()
abstract class AuthorizationApi {
  factory AuthorizationApi(Dio dio, {String baseUrl}) = _AuthorizationApi;

  @PUT("authorization/logIn")
  Future<HttpResponse<void>> logIn(@Query("phoneNumber") String phoneNumber,
      @Query("password") String password,@Query("enterpriseCode") String enterpriseCode);

  @DELETE("authorization")
  Future<void> logOut();

  @POST("authorization/updatePassword")
  Future<void> updatePassword(@Body() UpdatePasswordRequest request);
}

@freezed
class UpdatePasswordRequest with _$UpdatePasswordRequest{

  const factory UpdatePasswordRequest({
    required String password,
    required String newPassword,
  }) = _UpdatePasswordRequest;

  const UpdatePasswordRequest._();

  factory UpdatePasswordRequest.fromJson(Map<String, dynamic> json) => _$UpdatePasswordRequestFromJson(json);

}


AuthorizationApi authorizationApi = AuthorizationApi(dio, baseUrl: baseUrl);

